package com.jvm;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

/**
 * @program: jvm_test
 * @description: 内存溢出测试
 * @author: zxb
 * @date: 2021-01-02 16:13
 **/
public class OOMTest {
    public static List<Object> list = new ArrayList<Object>();
    // JVM设置
    // -Xms10M -Xmx10M -XX:+PrintGCDetails -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=D:\jvm.dump
    public static void main(String[] args){
        List<Object> list = new ArrayList<Object>();
        int i =0;
        int j =0;
        while(true){
            list.add(new User(i++, UUID.randomUUID().toString()));
            new User(j-- ,UUID.randomUUID().toString());
        }
    }


}
